Fix keyboard activation of menu buttons
authorMatthias Clasen <mclasen@redhat.com>
Mon, 19 Aug 2013 02:22:22 +0000 (22:22 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 19 Aug 2013 02:22:22 +0000 (22:22 -0400)
Keyboard activation relies on the menu not being visible,
so ensure that it isn't when the menu is attached.

Problem tracked down by Vincent Le Garrec,
https://bugzilla.gnome.org/show_bug.cgi?id=688738

gtk/gtkmenubutton.c

index 3c852b6140d28329627b0c6d6b09339dc4df7d89..d185a310cf8b92dea5e253d8d3dd16b1e6697815 100644 (file)
@@ -655,10 +655,7 @@ _gtk_menu_button_set_popup_with_func (GtkMenuButton                 *menu_button
     {
       if (gtk_widget_get_visible (GTK_WIDGET (priv->popup)))
         gtk_menu_shell_deactivate (GTK_MENU_SHELL (priv->popup));
-    }
 
-  if (priv->popup)
-    {
       g_signal_handlers_disconnect_by_func (priv->popup,
                                             menu_deactivate_cb,
                                             menu_button);
@@ -672,6 +669,7 @@ _gtk_menu_button_set_popup_with_func (GtkMenuButton                 *menu_button
       gtk_menu_attach_to_widget (GTK_MENU (priv->popup), GTK_WIDGET (menu_button),
                                  menu_detacher);
 
+      gtk_widget_set_visible (priv->popup, FALSE);
       gtk_widget_set_sensitive (GTK_WIDGET (menu_button), TRUE);
 
       g_signal_connect (priv->popup, "deactivate",